module.exports = function(BodyComposition,people) {
    // BodyComposition 体成分数据
    //people 用户数据
    //男生身高体重3-18范围值
    //MuscleMin 肌肉
    let height_max_nan=[99.4, 106.9, 114.2, 120.9, 127.4, 133.7, 139.3, 144.4, 149.9, 157.0, 164.8, 170.7, 174.2, 175.8, 176.4, 176.7];
    let height_min_nan=[94.2, 101.4, 108.4, 114.6, 120.6, 126.3, 131.4, 136.0, 140.8, 147.0, 154.3, 161.0, 165.4, 167.4, 168.2, 168.6];
    let weight_max_nan=[15.80, 17.98, 20.61, 23.26, 26.66, 30.71, 34.61, 38.61, 43.27, 48.86,55.21, 60.83, 64.40, 66.40, 67.51, 68.11];
    let weight_min_nan=[13.61, 15.43, 17.52, 19.49, 21.81, 24.46, 26.98, 29.66, 32.97,37.03,41.90, 46.90, 50.75, 53.26, 54.77, 55.60];
    //女生身高体重3-18范围值
    let height_max_nv=[98.2, 105.7, 113.1, 119.7, 125.9, 132.1, 138.0, 144.4, 151.1, 156.7, 160.3, 162.4, 163.5, 163.8, 164.0, 164.2];
    let height_min_nv=[93.1, 100.4, 107.3, 113.5, 119.2, 124.9, 130.2, 135.9, 142.2, 148.0, 152.2, 154.8, 156.1, 156.4, 156.7, 157.0];
    let weight_max_nv=[15.25, 17.50,19.83, 22.27, 24.94, 28.05, 31.63, 36.05, 41.24, 46.42, 50.45, 53.23, 54.96, 55.79, 56.11, 56.26];
    let weight_min_nv=[13.11, 14.97,16.84, 18.68, 20.62, 22.81, 25.23, 28.15, 31.81, 36.04, 40.00, 43.19, 45.36, 46.47, 46.90, 47.14];
    console.log(BodyComposition,'传过来的体成分数据')
    console.log(people,'传过来的用户数据')
    if(people.births<=6){
        BodyComposition.WaterMin=Math.round(people.contents.weight*0.5 * 100) / 100;//水分
        BodyComposition.WaterMax=Math.round(people.contents.weight*0.6 * 100) / 100;//水分
        BodyComposition.ProteinMin=Math.round(people.contents.weight*0.1215 * 100) / 100;//蛋白质
        BodyComposition.ProteinMax=Math.round(people.contents.weight*0.1485 * 100) / 100;//蛋白质
        BodyComposition.BoneMin=Math.round(people.contents.weight*0.036 * 100) / 100;//骨质
        BodyComposition.BoneMax=Math.round(people.contents.weight*0.044 * 100) / 100;//骨质
        BodyComposition.WHRMin=0.95;//腰臀比
        BodyComposition.WHRMax=1.05;//腰臀比
       
        BodyComposition.FatMin=Math.round(people.contents.weight*0.28 * 100) / 100;//脂肪
        BodyComposition.FatMax=Math.round(people.contents.weight*0.38 * 100) / 100;//脂肪
        BodyComposition.MuscleMin=Math.round(people.contents.weight*0.58 * 100) / 100;//肌肉
        BodyComposition.MuscleMax=Math.round(people.contents.weight*0.682 * 100) / 100;//肌肉
        BodyComposition.SMMMin=Math.round(people.contents.weight*0.29 * 100) / 100;;//骨骼肌
        BodyComposition.SMMMax=Math.round(people.contents.weight*0.34 * 100) / 100;;//骨骼肌
        if (people.births < 4){
            BodyComposition.BMIMin = 14.4;
            BodyComposition.BMIMax = 16.9;
        }else if (people.births < 5){
            BodyComposition.BMIMin = 14.3;
            BodyComposition.BMIMax = 16.8;
        }else if (people.births < 6){
            BodyComposition.BMIMin = 14.0;
            BodyComposition.BMIMax = 16.6;
        }else if (people.births == 6){
            BodyComposition.BMIMin = 13.1;
            BodyComposition.BMIMax = 16.2;
        }
        if(people.contents.sex==1){
            BodyComposition.WeightMin=weight_min_nv[people.births-3];//体重
            BodyComposition.WeightMax=weight_max_nv[people.births-3];//体重
            BodyComposition.PBFMin=20.0;//体脂百分比
            BodyComposition.PBFMax=25.0;//体脂百分比
        }else{
            BodyComposition.WeightMin=weight_min_nan[people.births-3];//体重
            BodyComposition.WeightMax=weight_max_nan[people.births-3];//体重
            BodyComposition.PBFMin=15.0;//体脂百分比
            BodyComposition.PBFMax=18.0;//体脂百分比
        }
    }else{
        if(people.contents.sex==1){//1是女2是男
            BodyComposition.WeightMin=weight_min_nv[people.births-3];//体重
            BodyComposition.WeightMax=weight_max_nv[people.births-3];//体重
            BodyComposition.MuscleMin=Math.round(((people.contents.weight*0.1395)+(people.contents.weight*0.55*0.9)) * 100) / 100;//肌肉
            BodyComposition.MuscleMax=Math.round(((people.contents.weight*0.1705)+(people.contents.weight*0.55*1.1)) * 100) / 100;//肌肉
            BodyComposition.PBFMin=18;//体脂百分比
            BodyComposition.PBFMax=28;//体脂百分比
            BodyComposition.BoneMin=Math.round(people.contents.weight*0.045 * 100) / 100;//骨质
            BodyComposition.BoneMax=Math.round(people.contents.weight*0.055 * 100) / 100;//骨质
            BodyComposition.WaterMin=Math.round(people.contents.weight*0.55*0.9 * 100) / 100;//水分
            BodyComposition.WaterMax=Math.round(people.contents.weight*0.55*1.1 * 100) / 100;//水分
            BodyComposition.SMMMin=Math.round(((people.contents.weight*0.1395+people.contents.weight*0.55*0.9)*0.58) * 100) / 100;//骨骼肌
            BodyComposition.SMMMax=Math.round(((people.contents.weight*0.1705+people.contents.weight*0.55*1.1)*0.58) * 100) / 100;//骨骼肌
            BodyComposition.WHRMin=0.7;//腰臀比
            BodyComposition.WHRMax=0.8;//腰臀比
            BodyComposition.ProteinMin=Math.round(people.contents.weight*0.1395 * 100) / 100;//蛋白质
            BodyComposition.ProteinMax=Math.round(people.contents.weight*0.1705 * 100) / 100;//蛋白质
            BodyComposition.FatMin=Math.round(people.contents.weight*0.18 * 100) / 100;//脂肪
            BodyComposition.FatMax=Math.round(people.contents.weight*0.28 * 100) / 100;//脂肪
            if (people.births < 4){
                BodyComposition.BMIMin = 14.4;
                BodyComposition.BMIMax = 16.9;
    
            }else if (people.births < 5){
                BodyComposition.BMIMin = 14.3;
                BodyComposition.BMIMax = 16.8;
    
            }else if (people.births < 6){
                BodyComposition.BMIMin = 14.0;
                BodyComposition.BMIMax = 16.6;
    
            }else if (people.births < 7){
                BodyComposition.BMIMin = 13.1;
                BodyComposition.BMIMax = 16.2;
    
            }else if (people.births < 8){
                BodyComposition.BMIMax = 17.2; 
                BodyComposition.BMIMin = 13.4;
    
            }else if (people.births < 9){
                BodyComposition.BMIMax = 18.1;
                BodyComposition.BMIMin = 13.6;
    
            }else if (people.births < 10){
                BodyComposition.BMIMax = 18.5;
                BodyComposition.BMIMin = 13.8;
    
            }else if (people.births < 11){
                BodyComposition.BMIMax = 19.0;
                BodyComposition.BMIMin = 14.0;
    
            }else if (people.births < 12){
                BodyComposition.BMIMax = 21.1;
                BodyComposition.BMIMin = 14.3;
    
            }else if (people.births < 13){
                BodyComposition.BMIMax = 21.9;
                BodyComposition.BMIMin = 14.7;
    
            }else if (people.births < 14){
                BodyComposition.BMIMax = 22.6;
                BodyComposition.BMIMin = 15.3;
    
            }else if (people.births < 15){
                BodyComposition.BMIMax = 23.0;
                BodyComposition.BMIMin = 16.0;
    
            }else if (people.births < 16){
                BodyComposition.BMIMax = 23.4;
                BodyComposition.BMIMin = 16.6;
    
            }else if (people.births < 17){
                BodyComposition.BMIMax = 23.7;
                BodyComposition.BMIMin = 17.0;
    
            }else if (people.births < 18){
                BodyComposition.BMIMax = 23.8;
                BodyComposition.BMIMin = 17.2;
    
            }else if (people.births >= 18){
                BodyComposition.BMIMax = 24.0;
                BodyComposition.BMIMin = 18.5;
            }
        }else{//男
            BodyComposition.WeightMin=weight_min_nan[people.births-3];//体重
            BodyComposition.WeightMax=weight_max_nan[people.births-3];//体重
            BodyComposition.MuscleMin=Math.round((people.contents.weight*0.1395)+(people.contents.weight*0.6*0.9) * 100) / 100;//肌肉
            BodyComposition.MuscleMax=Math.round((people.contents.weight*0.1705)+(people.contents.weight*0.6*1.1) * 100) / 100;//肌肉
            BodyComposition.PBFMin=10;//体脂百分比
            BodyComposition.PBFMax=20;//体脂百分比
            BodyComposition.BoneMin=Math.round(people.contents.weight*0.045 * 100) / 100;//骨质
            BodyComposition.BoneMax=Math.round(people.contents.weight*0.055 * 100) / 100;//骨质
            BodyComposition.WaterMin=Math.round(people.contents.weight*0.6*0.9 * 100) / 100;//水分
            BodyComposition.WaterMax=Math.round(people.contents.weight*0.6*1.1 * 100) / 100;//水分
            BodyComposition.SMMMin=Math.round((people.contents.weight*0.1395+people.contents.weight*0.6*0.9)*0.58 * 100) / 100;//骨骼肌
            BodyComposition.SMMMax=Math.round((people.contents.weight*0.1705+people.contents.weight*0.6*1.1)*0.58 * 100) / 100;//骨骼肌
            BodyComposition.WHRMin=0.85;//腰臀比
            BodyComposition.WHRMax=0.95;//腰臀比
            BodyComposition.ProteinMin=Math.round(people.contents.weight*0.1395 * 100) / 100;//蛋白质
            BodyComposition.ProteinMax=Math.round(people.contents.weight*0.1705 * 100) / 100;//蛋白质
            BodyComposition.FatMin=Math.round(people.contents.weight*0.1 * 100) / 100;//脂肪
            BodyComposition.FatMax=Math.round(people.contents.weight*0.2 * 100) / 100;//脂肪
            if (people.births < 4){
                BodyComposition.BMIMin = 14.4;
                BodyComposition.BMIMax = 16.9;
    
            }else if (people.births < 5){
                BodyComposition.BMIMin = 14.3;
                BodyComposition.BMIMax = 16.8;
    
            }else if (people.births < 6){
                BodyComposition.BMIMin = 14.0;
                BodyComposition.BMIMax = 16.6;
    
            }else if (people.births < 7){
                BodyComposition.BMIMin = 13.1;
                BodyComposition.BMIMax = 16.2;
    
            }else if (people.births < 8){
                BodyComposition.BMIMax = 17.4;
                BodyComposition.BMIMin = 13.9;
    
            }else if (people.births < 9){
                BodyComposition.BMIMax = 18.1;
                BodyComposition.BMIMin = 14.0;
    
            }else if (people.births < 10){
                BodyComposition.BMIMax = 18.5;
                BodyComposition.BMIMin = 14.1;
    
            }else if (people.births < 11){
                BodyComposition.BMIMax = 18.9;
                BodyComposition.BMIMin = 14.4;
    
            }else if (people.births < 12){
                BodyComposition.BMIMax = 20.3;
                BodyComposition.BMIMin = 14.9;
    
            }else if (people.births < 13){
                BodyComposition.BMIMax = 21.0;
                BodyComposition.BMIMin = 15.4;
    
            }else if (people.births < 14){
                BodyComposition.BMIMax = 21.9;
                BodyComposition.BMIMin = 15.9;
    
            }else if (people.births < 15){
                BodyComposition.BMIMax = 22.6;
                BodyComposition.BMIMin = 16.4;
    
            }else if (people.births < 16){
                BodyComposition.BMIMax = 23.1;
                BodyComposition.BMIMin = 16.9;
    
            }else if (people.births < 17){
                BodyComposition.BMIMax = 23.5;
                BodyComposition.BMIMin = 17.3;
    
            }else if (people.births < 18){
                BodyComposition.BMIMax = 23.8;
                BodyComposition.BMIMin = 17.7;
    
            }else if (people.births == 18){
                BodyComposition.BMIMax = 24.0;
                BodyComposition.BMIMin = 18.5;
            }
        }
    }
    
    return BodyComposition;
  }